package com.base.myproject.client.jdbc;

import java.io.Serializable;
import java.util.Vector;

public class DataSet implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -670895950551932457L;
	Vector<Row> v = new Vector<Row>();
/**
 * 空的构造函数，序列化的要求
 */
	
	public DataSet()
	{
		
	}
	public void addRow(Row row)
	{
		v.add(row);
		
	}
	public void removerow(Row row)
	{
		v.remove(row);
	}
	public String getValue(int rownum,String name)
	{
		return v.get(rownum).getValue(name);
	}
	public String  getValue(int rownum,int columnindex)
	{
		return v.get(rownum).getValue(columnindex);
	}
/*	*//**
	 * 获取日期类型的字段值
	 * @param rownum
	 * @param name
	 * @return
	 *//*
	public Date getDate(int rownum,String name)
	{
		return v.get(rownum).getDateValue(name);
	}*/
	/**
	 * 获得字段类型
	 * @param rownum
	 * @param name
	 * @return
	 */
	public int getCellType(int rownum,String name)
	{
		return v.get(rownum).getCellType(name);
	}
	public String toString()
	{
		String str = "";
		for(Row row : v)
		{
			for(Cell cell:row.getVector())
			{
				str +=" name="+cell.getCellname()+" value="+cell.getValue();
			}
			str +="\n";
		}
		return str;
	}
	/**
	 * dataset的行数
	 * @return
	 */
	public int getRowCount()
	{
		return v.size();
	}
	/**
	 * 取得字段数量
	 * @return
	 */
	public int getColumncount()
	{
		return v.get(0).getVector().size();
	}
	
	public Row getRow(int index)
	{
		return v.get(index);
	}
}
